#ifndef XPM_DOC_MODEL_SDF_DENOTATION_H
#define XPM_DOC_MODEL_SDF_DENOTATION_H

#include <string>
#include "model/XpmTermBlock.h"
using namespace std;

namespace xpm {
	
	class SDFDenotation {
	public:		
		typedef TermIter iterator;
		SDFDenotation():_termblock(0) {}
		SDFDenotation::iterator begin();
		SDFDenotation::iterator end();
		// apis
		wstring de_str() const;
		void set_de_str(wstring denotationstr);
		void append_literals(wstring literals);
		void append_atom_sign(wstring text, conex::Term* term);
		void append_map(int pos, wstring text, conex::Term* term);
		int size();
		bool empty();
		void clear();
	private:
		wstring _de_str;
		XpmTermBlock _termblock;
	};
	inline int SDFDenotation::size() {
		return _termblock.size();
	}
	inline bool SDFDenotation::empty() {
		if (size() == 0)
			return true;
		else
			return false;
	}
	inline void SDFDenotation::clear() {
		_termblock.clear();
	}
	inline SDFDenotation::iterator SDFDenotation::begin() {
		return _termblock.GetTerms().begin();
	}
	inline SDFDenotation::iterator SDFDenotation::end() {
		return _termblock.GetTerms().end();
	}
	inline wstring SDFDenotation::de_str() const {
		return _de_str;
	}
	inline void SDFDenotation::set_de_str(wstring denotationstr) {
		_de_str = denotationstr;
	}
	inline void SDFDenotation::append_literals(wstring literals) {
		_de_str.append(literals);
	}
	inline void SDFDenotation::append_atom_sign(wstring text, conex::Term* term) {
		int startpos = _de_str.size();
		_termblock.AppendTermRange(startpos, text, term);
		_de_str.append(text);
	}
	inline void SDFDenotation::append_map(int pos, wstring text, conex::Term* term) {
		_termblock.AppendTermRange(pos, text, term);
	}
}
#endif